<template>
  <div>
    <table-ext :columns="columns" :searchForm="searchForm" :config="config" ref="tableExt">
        <template slot="table-action">
          <el-button type="primary" icon="el-icon-plus" @click="toEdit(0)">新增</el-button>
          <el-button type="primary" icon="el-icon-success" @click="batchPublish">发布</el-button>
          <el-button type="info" icon="el-icon-refresh" @click="batchUnPublish">取消发布</el-button>
          <el-button type="primary" icon="el-icon-success" @click="batchExeComplete">标记为执行完毕</el-button>
          <el-button type="primary" icon="el-icon-success" @click="exportQuery">导出</el-button>
       </template>
    </table-ext>
    <el-dialog :title="dlTitle" :visible.sync="dl.sync" width="98%">
      <ContractEdit @createSuc="createSuc" :contract="contract" :purContractTypeList="purContractTypeList"></ContractEdit>
    </el-dialog>
    <el-dialog :title="upSeal.title" :visible.sync="upSeal.sync" width="40%">
      <el-form>
        <el-form-item label="盖章附件">
        <input type="file" @change="upSealChange"/>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="upSeal.sync = false">取 消</el-button>
        <el-button type="primary" @click="sealAttSubmit">确 定</el-button>
      </span>
    </el-dialog>
    <contract-notice :id="notice.id" v-model="notice.show"></contract-notice>
    <el-dialog :visible.sync="contentEditor.sync" :fullscreen="true" title="合同编辑" @close="contentEditorClose">
      <content-edit v-model="editId" @editContentSuc='editContentSuc' ref="contentEditor"></content-edit>
      <span slot="footer" class="dialog-footer">
        <el-button @click="contentEditorClose">取 消</el-button>
        <el-button type="primary" @click="saveContent">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="contentViewer.sync" :fullscreen="true" title="合同查看" @close="contentViewerClose">
      <content-view v-model="viewId" @viewRefresh="viewRefresh"  ref="contentViewer"></content-view>
    </el-dialog>
    <el-dialog :visible.sync="milestone.sync" :fullscreen="true" title="合同里程碑" @close="milestoneClose">
      <Milestone v-model="milestoneId"  ref="milestone"></Milestone>
    </el-dialog>
    <el-dialog :visible.sync="freeDlSync" width="90%" title="合同查看" @close="this.freeDlSync=false">
      <el-form v-model="freeContract">
        <el-row style="text-align:center;"><strong>{{freeContract.contractName}}</strong></el-row>
        <el-row>
          <el-col :span="12"><el-form-item label="需方:">{{freeContract.companyName}}</el-form-item></el-col>
          <el-col :span="12"><el-form-item label="合同号:">{{freeContract.code}}</el-form-item></el-col>
        </el-row>
        <el-row>
          <el-col :span="12"><el-form-item label="供方:">{{freeContract.vendorName}}</el-form-item></el-col>
          <el-col :span="12"><el-form-item label="签订时间:">{{freeContract.signDate}}</el-form-item></el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-table :data="freeContract.itemList">
              <el-table-column label="物料编码" prop="materialCode"></el-table-column>
              <el-table-column label="物料名称" prop="materialName"></el-table-column>
              <el-table-column label="单位" prop="unitName"></el-table-column>
              <el-table-column label="单价" prop="unitPrice"></el-table-column>
              <el-table-column label="数量" prop="itemQty"></el-table-column>
              <el-table-column label="金额" prop="total"></el-table-column>
            </el-table>
          </el-col>
        </el-row>
        <el-row>
          <el-col><el-form-item label="合同附件"><el-button type="text" @click="downloadFile(freeContract.attFileUrl,freeContract.attFileName)">{{freeContract.attFileName}}</el-button></el-form-item></el-col>
        </el-row>
      </el-form>
      <el-row v-if="canCheck">
        <el-col :span="24">
          <el-button  @click="check">审核</el-button>
          <check-util v-model="checkSync" :checkObj="checkObj" @checkSuc="checkSuc"></check-util>
        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>
<script>
  import qs from 'qs';
  import TableExt from '@/components/common/table-ext/table-ext.vue';
  import TableIcon from '@/components/common/table-ext/table-icon';
  import ContractEdit from '@/components/contract/contractEdit';
  import ContractNotice from '@/components/contract/contractNotice';
  import ContentEdit from '@/components/contract/contractContentEdit';
  import ContentView from '@/components/contract/contractContentView';
  import Milestone from '@/components/contract/contractMilestone';
  import CheckUtil from '@/components/common/util/checkUtil';
   export default {
    // 引入自定义表格组件
    components:{
      'table-ext': TableExt,
      ContractEdit,
      ContractNotice,
      ContentEdit,
      ContentView,
      CheckUtil
    },
    data() {
      return {
        host: this.lib.config.host.contract,
        canCheck: false,
        checkSync:false,
        checkObj:{
          id: '',
          url: '',
          statusCode: '',
          opinionCode: '',
          fileCode:'',
          isChildren:true
        },
        freeContract: '',
        freeDlSync: false,
        editId: '',
        viewId: '',
        milestoneId: '',
        milestone: {
          sync: false
        },
        contentEditor: {
          sync: false
        },
        contentViewer: {
          sync: false
        },
        contract : null,
        purContractTypeList : [],
        selectedContract: null,
        dl: {
          sync: false,
          erpFlag: false
        },
        upSeal: {
          title: '盖章附件上传',
          sync: false,
          id: '',
          file: ''
        },
        notice:{
          id: '',
          show: false
        },
        config:{ // 页面共通配置
          title: '合同', //页面标题
          isPage: true, //是否分页
          isNo: true, //是否显示序号
          selection: true,
          crudMapping:{ // CRUD方法
            query:{
              url: this.lib.config.host.contract + '/contractmgt/contract/query'
            }
          }
        },
        // 查询表单配置
        searchForm:[
        {
          label: '采购组织编码', 
          key: 'purOrgCode', 
          type: 'input' 
        },{
          label: '采购组编码',
          key: 'purGroupCode',
          type: 'input'
        },{
          label: '合同号',
          key: 'code',
          type: 'input'
        },{
          label: 'erp编号', 
          key: 'erpCode', 
          type: 'input' 
        },{
          label: '合同模板',
          key: 'contractTemplateId',
          type: 'input'
        },{
          label: '合同名称',
          key: 'contractName',
          type: 'input'
        },{
          label: '供应商编码', 
          key: 'vendorCode', 
          type: 'input' 
        },{
          label: '公司编码',
          key: 'companyCode',
          type: 'input'
        },{
          label: '公司名称',
          key: 'companyName',
          type: 'input'
        },{
          label: '完成状态',
          key: 'completeStatus',
          type: 'select',
          dict :[
              {lable: '未完成',value: '0'},
              {lable: '已完成',value: '1'}
          ]
        },{
          label: '发布状态',
          key: 'publishStatus',
          type: 'select',
          dict :[
              {lable: '未发布',value: '0'},
              {lable: '已发布',value: '1'}
          ]
        },{
           label: '发布时间',
           key: 'publishTime',
           type: 'date' 
        },{
           label: '采购员',
           key: 'purUserName',
           type: 'input' 
        },{
           label: '确认状态',
           key: 'confirmStatus',
           type: 'select',
           dict :[
              {lable: '未确认',value: '0'},
              {lable: '已确认',value: '1'},
              {lable: '已驳回',value: '-1'}
          ] 
        },{
           label: '审核状态',
           key: 'checkStatus',
           type: 'select',
           dict :[
              {lable: '未审核',value: '0'},
              {lable: '已审核',value: '1'},
              {lable: '已驳回',value: '-1'}
          ] 
        },{
           label: '盖章附件上传',
           key: 'hasSealAttachment',
           type: 'select',
           dict :[
              {lable: '未上传',value: '0'},
              {lable: '已上传',value: '1'}
          ] 
        },{
           label: '生效状态',
           key: 'effectiveStatus',
           type: 'select',
           dict :[
              {lable: '未生效',value: '0'},
              {lable: '已生效',value: '1'}
          ] 
        },{
           label: 'erp提交状态',
           key: 'submitStatus',
           type: 'select',
           dict :[
              {lable: '未提交',value: '0'},
              {lable: '已提交',value: '1'}
          ] 
        },{
           label: 'erp同步状态',
           key: 'syncStatus',
           type: 'select',
           dict :[
              {lable: '未同步',value: '0'},
              {lable: '已同步',value: '1'},
              {lable: '同步失败',value: '-1'}
          ] 
        },{
           label: '执行状态',
           key: 'executingState',
           type: 'select',
           dict :[
              {lable: '未执行',value: '0'},
              {lable: '已完成',value: '1'},
              {lable: '执行中',value: '-1'}
          ] 
        },{
           label: '采购申请号',
           key: 'purReqNo',
           type: 'input'
        },{
           label: '采购申请行号',
           key: 'purReqItemNo',
           type: 'input'
        }
        ],
        // 表格列定义
        columns:[{
          label: 'id',
          key: 'id',
          hidden: true
        },
        {
          label: '操作',
          key: 'opt',
          width: 120,
          fixed: true,
          align: 'center',
          render: (h,ctx)=>{
            let children = [];
            let r = ctx.row;
            let _this = this;
            if(r.publishStatus == 0){
              children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.toEdit(r.id)}}},'编辑'));
            }
            if(r.confirmStatus<=0){
              children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.softDelete(r.id)}}},'删除'));
            }
            if(r.effectiveStatus!=-1 && r.checkStatus==1 && r.hasSealAttachment!=1){
              children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.uploadSealAtt(r.id)}}},'上传盖章附件'));
            }
            if(r.checkStatus==1 && r.hasSealAttachment==1){
              children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.cancelSealAtt(r.id)}}},'取消盖章附件'));
            }
            if(r.checkStatus==3 && r.confirmStatus==1){
              children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.toView(r.id,r.contractModel,r)}}},'审核'));
            }
            if(r.hasSealAttachment==1 && r.effectiveStatus!=1){
              children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.effective(r.id,r.effectiveStatus)}}},'生效'));
            }
            if(r.syncStatus!=null && r.syncStatus==-1){
              children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.upload(r.id)}}},'重新上传ERP'));
            }
            // if(r.confirmStatus==1){
            //   children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.abolish(r.id)}}},'废除'));
            // }
            if(r.checkStatus==1){
              children.push(h('el-button',{props : {type: 'text'},on: {click(){_this.milestone(r.id)}}},'里程碑'));
            }
            return h('div',{},children.length>=0?children:'--');
          }
        },{
          label: '公司名称',
          key: 'companyName'
        },{
          label: '采购组织名称',
          key: 'purOrgName'
        },{
          label: '采购组名称',
          key: 'purOrgName'
        },{
          label: '合同编号',
          key: 'code',
          width: 120,
          align: 'center',
          render:(h,ctx)=>{
            let _this = this;
            // if(ctx.row.contractModel==1){
            //   return h('span',{},ctx.row.code);
            // }
            return h('a',{style:{color:'#409EFF',cursor:'pointer'},on:{click(){
              _this.toView(ctx.row.id,ctx.row.contractModel,ctx.row);
            }}},ctx.row.code);
          }
        },{
          label: '合同名称',
          key: 'contractName'
        },{
          label: 'erp编号',
          key: 'erpCode'
        },{
          label: '合同模式',
          key: 'contractModel',
          align: 'center',
          render:(h, ctx)=>{ 
            return h('el-tag',{},ctx.row.contractModel==0?'标准':'非标准');
          }
        },{
          label: '供应商编码',
          key: 'vendorCode'
        },{
          label: '供应商名称',
          key: 'vendorName'
        },{
          label: '补充协议数量',
          key: 'addendumCount'
        },{
          label: '生效开始时间',
          key: 'effectiveDateStart'
        },{
          label: '失效时间',
          key: 'effectiveDateEnd'
        },{
          label: '采购员',
          key: 'purUserName'
        },{
          label: '完成状态',
          key: 'completeStatus',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.completeStatus,
                titles: [{status:0,title:'未完成'},{status:1,title:'已完成'}]
            }});
          }
        },{
          label: '发布状态',
          key: 'publishStatus',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.publishStatus,
                titles: [{status:0,title:'未发布'},{status:1,title:'已发布'}]
            }});
          }
        },{
          label: '确认状态',
          key: 'confirmStatus',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.confirmStatus,
                titles: [{status:0,title:'未确认'},{status:1,title:'已确认'},{status:-1,title:'已驳回'}]
            }});
          }
        },{
          label: '审核状态',
          key: 'checkStatus',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.checkStatus,
                titles: [{status:0,title:'未审核'},{status:1,title:'已审核'},{status:-1,title:'已驳回'}]
            }});
          }
        },{
          label: '生效状态',
          key: 'effectiveStatus',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.effectiveStatus,
                titles: [{status:0,title:'未生效'},{status:1,title:'已生效'}]
            }});
          }
        },{
          label: 'erp提交状态',
          key: 'submitStatus',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.submitStatus,
                titles: [{status:0,title:'未提交'},{status:1,title:'已提交'}]
            }});
          }
        },{
          label: 'erp同步状态',
          key: 'syncStatus',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.syncStatus,
                titles: [{status:0,title:'未提交'},{status:1,title:'已提交'}]
            }});
          }
        },{
          label: '执行状态',
          key: 'executingState',
          render:(createElement, params)=>{ //动态渲染, 字典表示例
            return createElement(TableIcon,{props:{
                flag: params.row.executingState,
                titles: [{status:0,title:'未执行'},{status:1,title:'已完成'},{status:2,title:'执行中'}]
            }});
          }
        },{
          label: '公告',
          key: 'notice',
          align: 'center',
          render:(h, ctx)=>{ 
            let _this = this;
            return h('el-button',{props: {type: 'text'},
                    on:{
                      click(){
                        _this.notice.id=ctx.row.id;
                        _this.notice.show=true;
                        }}},'公告');
                  }
        },{
          label: '附件',
          key: 'attFileName',
          align: 'center',
          render:(h, ctx)=>{ 
            if(ctx.row.attFileUrl==null){
              return null;
            }
            let _this = this;
            return h('el-button',{props: {type: 'text'},
            on:{
              click(){
                _this.downloadFile(ctx.row.attFileUrl,ctx.row.attFileName);
                }}},'附件');
          }
        },{
          label: '盖章附件',
          key: 'sealAtt',
          align: 'center',
          render:(h, ctx)=>{ 
            if(ctx.row.sealAttUrl==null){
              return null;
            }
            let _this = this;
            return h('el-button',{props: {type: 'text'},
            on:{
              click(){
                _this.downloadFile(ctx.row.sealAttUrl);
                }}},'盖章附件');
          }
        },{
          label: '错误消息',
          key: 'errMsg'
        }
       ]
      }
      
    },
    created() {
      if (this.$route.query) {
        this.config.crudMapping.query.data = this.$route.query;
      }
    },
    computed: {
      dlTitle(){
        return this.selectedContract==null?'新增':'编辑';
      }
    },
    methods: {
        toEdit(id){
          let _this = this;
          this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/edit/'+id).
          then(res=>{
            if(!res.data.success){
                _this.showMsg('error',res.data.message);
                return;
            }
            let result = res.data.resultMap;
            _this.contract = result.contract;
            _this.purContractTypeList = result.purContractTypeList;
            _this.dl.sync = true;

          }).
          catch(e=>{
            _this.showMsg('error',e);
          });
         
        },
        toView(id,contractModel,contract){
          debugger;
          if(contractModel==0){
            this.viewId = id;
            this.contentViewer.sync = true;
          }else{
            let params = qs.stringify({contractId:id});
            this.axios.post(this.host+'/contractmgt/contract/getAllItemList',params).
            then(res=>{
              this.canCheck= (contract.checkStatus==3 && contract.confirmStatus==1);
              this.freeContract = contract;
              this.freeContract.itemList = res.data;
              this.freeDlSync = true;
            });
          }
        },
        batchPublish(){
          var idList = this.$refs.tableExt.getCheckedIdArray();
		      if(idList.length==0)return false;
          this.$confirm('确认发布吗?','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(()=>{
             let params = qs.stringify({idList:idList},{arrayFormat: 'brackets'}) ;
             this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/batchPublish',params).
             then(res=>{
               if(res.data.success){
                 this.showMsg('success','发布成功');
                 this.$refs.tableExt.refreshTable();
               }else{
                 this.showMsg('errror',res.data.message);
               }
             }).catch(e=>{this.showMsg('errror',e);});
          });
        },
        batchUnPublish(){
          var idList = this.$refs.tableExt.getCheckedIdArray();
		      if(idList.length==0)return false;
          this.$confirm('确认取消发布吗?','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(()=>{
             let params = qs.stringify({idList:idList},{arrayFormat: 'brackets'}) ;
             this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/batchUnPublish',params).
             then(res=>{
               if(res.data.success){
                 this.showMsg('success','取消发布成功');
                 this.$refs.tableExt.refreshTable();
               }else{
                 this.showMsg('errror',res.data.message);
               }
             }).catch(e=>{this.showMsg('errror',e);});
          });
        },
        batchExeComplete(){
          var idList = this.$refs.tableExt.getCheckedIdArray();
		      if(idList.length==0)return false;
          this.$confirm('确认标记为已执行吗?','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(()=>{
             let params = qs.stringify({idList:idList},{arrayFormat: 'brackets'}) ;
             this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/batchExeComplete',params).
             then(res=>{
               if(res.data.success){
                 this.showMsg('success','已标记为已执行');
                 this.$refs.tableExt.refreshTable();
               }else{
                 this.showMsg('errror',res.data.message);
               }
             }).catch(e=>{this.showMsg('errror',e);});
          });
        },
        exportQuery(){
          var params = this.$refs.tableExt.searchParam;
		      if(idList.length==0)return false;
          this.$confirm('确认导出吗？','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(()=>{
             this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/export',params).
             then(res=>{
               this.$refs.tableExt.refreshTable();
             });
          });
        },
        checkConfirm(id){
          this.$confirm('确认审核通过该合同?','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(()=>{
             let params = qs.stringify({id:id});
             this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/checkConfirm',params).
             then(res=>{
               if(res.data.success){
                 this.showMsg('success','审核成功');
                 this.$refs.tableExt.refreshTable();
               }else{
                 this.showMsg('errror',res.data.message);
               }
             }).catch(e=>{this.showMsg('errror',e);});
          });
        },        
        checkReject : function(id){
          // $('#dg-reject').dialog('open');
          // $('#dg-reject-form').getCmp('id').val(id);
        },
        checkRejectSubmit : function(){
          // easyUISubimit('dg-reject-form', '/contractmgt/contract/checkReject', function(data){
          //   if(data.success){
          //     $('#datagrid').datagrid('reload');
          //     $('#dg-reject').dialog('close');
          //   }
          // }, true, false);
        },
        uploadSealAtt : function(id){
          this.upSeal.sync = true;
          this.upSeal.id = id;
        },
        sealAttSubmit : function(){
          let formData = new FormData();
          formData.append('id',this.upSeal.id);
          formData.append('sealAttFile',this.upSeal.file);
          let config = {
            headers: {  
              'Content-Type': 'multipart/form-data'  
            }  
          };
          this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/vendor/uploadSealAtt',formData,config).
          then(res=>{
            if(res.data.success){
              this.$refs.tableExt.refreshTable();
              this.upSeal.sync = false;
              return;
            }
            this.showMsg('error',res.data.message);
          }).catch(e=>{
            this.showMsg('error',e);
          });
        },
        //撤销盖章附件
        cancelSealAtt : function(id){
          this.$confirm('确认撤销该盖章附件吗？','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(()=>{
             let params = qs.stringify({id:id});
             this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/vendor/cancelSealAtt',params).
             then(res=>{
               if(res.data.success){
                 this.showMsg('success','盖章附件已撤销');
                 this.$refs.tableExt.refreshTable();
               }else{
                 this.showMsg('errror',res.data.message);
               }
             }).catch(e=>{this.showMsg('errror',e);});
          });          
        },
        abolish : function(id){
          // CheckUtil.openCustom(id, '/contractmgt/contract/effective', function(result){
          //   $('#dg-abolish').dialog('close');
          //   $('#datagrid').datagrid('reload');
          // }, false, false, {title:I18N.getText('common.void'),dgId:'dg-abolish',formId:'fm-abolish',opinionName:'abolishOpinion',opinionReq:true,statusName:'effectiveStatus',defaultValue:-1});
        },
        /** 生效和作废 */
        effective:function(id,effectiveStatus){
          if(effectiveStatus==0){
            effectiveStatus = 1;
          }else{
            effectiveStatus = 0 ;
          }
          this.$confirm('确认生效吗?','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(()=>{
             let params = qs.stringify({id:id,effectiveStatus:effectiveStatus});
             this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/effective',params).
             then(res=>{
               if(res.data.success){
                 this.showMsg('success','合同已生效');
                 this.$refs.tableExt.refreshTable();
               }else{
                 this.showMsg('errror',res.data.message);
               }
             }).catch(e=>{this.showMsg('errror',e);});
          });           
        },
        softDelete : function(id){
          this.$confirm('合同删除后不可恢复，确认删除吗?','提示',{
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(()=>{
             let params = qs.stringify({id:id});
             this.axios.post(this.lib.config.host.contract+'/contractmgt/contract/delete',params).
             then(res=>{
               if(res.data.success){
                 this.showMsg('success','删除成功');
                 this.$refs.tableExt.refreshTable();
               }else{
                 this.showMsg('errror',res.data.message);
               }
             }).catch(e=>{this.showMsg('errror',e);});
          }); 
        },
        createSuc(contractId,contractModel){
          this.dl.sync = false;
          this.$refs.tableExt.refreshTable();
          if(contractId!='' && contractModel==0){
            this.contentEditor.sync = true;
            this.editId = contractId;
          }
        },
        upSealChange(event){

          this.upSeal.file = event.target.files[0];
        },
        saveContent(){
          this.$refs.contentEditor.save();
        },
        editContentSuc(){
           this.contentEditor.sync = false;
           this.$refs.tableExt.refreshTable();
           this.editId = '';
        },
        contentEditorClose(){
          this.editId = '';
          this.contentEditor.sync = false;
        },
        contentViewerClose(){
          this.viewId = '';
          this.contentViewer.sync = false;
        },
        viewRefresh(){
          this.$refs.tableExt.refreshTable();
        },
        milestoneClose(id){
          this.milestoneId = id;
          this.milestone.sync = false;
        },
        milestoneClose(){
          this.viewId= '';
          this.milestone.sync= false;
        },
        check(){
          this.checkObj = {
          id: this.freeContract.id,
          url : this.lib.config.host.contract+'/contractmgt/contract/check',
          statusCode: 'checkStatus',
          opinionCode: 'checkOpinion',
          fileCode: 'checkAttFile',
          isChildren:true
          }
          this.checkSync = true;
        },
        checkSuc(){
          this.checkSync = false;
          this.canCheck= false;
          this.$refs.tableExt.refreshTable();
        }
    }
  }
</script>
<style>


</style>
